package com.xuecheng.content.convert;

import com.xuecheng.api.content.model.dto.TeachplanDTO;
import com.xuecheng.api.content.model.vo.TeachplanVO;
import com.xuecheng.content.entity.ext.TeachPlanNodes;
import com.xuecheng.content.entity.Teachplan;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

@Mapper
public interface EntityMapperTeachPlan {

    EntityMapperTeachPlan INSTANCE = Mappers.getMapper(EntityMapperTeachPlan.class);

    @Mappings({
            @Mapping( source = "id",target = "teachPlanId"),
            @Mapping( source = "childrenNodes",target = "teachPlanTreeNodes"),
    })
    TeachplanDTO TeachplanToTeachplanDto(TeachPlanNodes teachPlanNodes);
    TeachplanDTO TeachplanPoToTeachplanDto(Teachplan teachPlan);


    @Mappings({
            @Mapping( source = "teachPlanId",target = "teachPlanId"),

    })
    TeachplanDTO TeachplanVoToTeachplanDto(TeachplanVO teachplanVO);


    @Mappings({
            @Mapping( source = "teachPlanId",target = "id"),

    })
    Teachplan TeachplanDTOToTeachplanPo(TeachplanDTO teachplanDTO);
}
